/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.ctu.android.DriveCommunicator.dialogs;


import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import cz.ctu.android.DriveCommunicator.R;
import cz.ctu.android.DriveCommunicator.activities.ReplyKeyboardActivity;
import cz.ctu.android.DriveCommunicator.activities.ReplyPredefinedActivity;

/**
 *
 * @author karlos
 */
public class ReplyMessageDialog extends Dialog {
    
    private Button predefined;
    
    private Button gesture;
    
    private Button speech;
    
    private Button keyboard;
    
    public ReplyMessageDialog(Context c) {
        super(c);
    }
    
    @Override
    public void onCreate(Bundle b) {
        super.onCreate(b);
        
        // set layout
        setContentView(R.layout.dialog_message_reply);

        predefined = (Button) findViewById(R.id.predefined);
        gesture = (Button) findViewById(R.id.gesture);
        speech = (Button) findViewById(R.id.speech);
        keyboard = (Button) findViewById(R.id.keyboard);
        
        predefined.setOnClickListener(new ButtonHandler(ReplyPredefinedActivity.class));
        keyboard.setOnClickListener(new ButtonHandler(ReplyKeyboardActivity.class));
        // gesture button
        // speech button
        
        
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    }
    
    class ButtonHandler implements Button.OnClickListener {
        
        private Class activity;

        public ButtonHandler(Class destinationActivity) {
            activity = destinationActivity;
        }
        
        public void onClick(View view) {
            if (activity != null) {
                Intent intent = new Intent(getContext(), activity);
                getContext().startActivity(intent);
                hide();
            }
        }
        
    }
    
}
